﻿using System;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;

namespace SilverMap.Editor
{
	public partial class CursorIcon : UserControl
	{
		public ImageSource Source
		{
			get { return (ImageSource)GetValue(SourceProperty); }
			set { SetValue(SourceProperty, value); }
		}
		public static readonly DependencyProperty SourceProperty = DependencyProperty.Register("Source", typeof(ImageSource), typeof(CursorIcon), new PropertyMetadata(null, new PropertyChangedCallback(CursorIcon.OnSourcePropertyChanged)));
		private static void OnSourcePropertyChanged(DependencyObject obj, DependencyPropertyChangedEventArgs e)
		{
			var cur = obj as CursorIcon;
			if (cur == null)
				return;

			cur.IconImage.Source = cur.Source;
		}
           
		public CursorIcon()
		{
			// Required to initialize variables
			InitializeComponent();
		}

		public void MoveTo(Point p)
		{
			Canvas.SetLeft(this, p.X);
			Canvas.SetTop(this, p.Y);
		}
	}
}